import { DebugDraw } from "../draw";
import { getGameObjectById } from "../engine";
import { Behaviour } from "../engine/Behaviour";
import { TextRenderer } from "../engine/TextRenderer";
import { Transform } from "../engine/Transform";
import { number } from "../engine/validators/number";

export class Order extends Behaviour {
    private currentSpeed = 0;
    @number()
    speed = 1;
    Order1="来一份经典原味的烤冷面！";
    Order2="老板，我要一个经典加肠烤冷面。";
    Order3="来份火辣辣烤冷面！";
    Order4="我要一个加鸡柳烤冷面。";
    Order5="我要一个烤冷面加培根。";
        
    Order_what=0;


    onStart() {
        let i=this.GetRandomNum(1,5);
        this.SelectOrder(i);
       
    }

    onTick(duringTime: number) {
      /*  const transform = this.gameObject.getBehaviour(Transform);
        transform.x += this.currentSpeed;*/
    }

    SelectOrder(x:number){
        let order_detail:string;
        switch(x){
            case 1:{
                getGameObjectById('UI_dialog_requirement').getBehaviour(TextRenderer).text=this.Order1;
                this.Order_what=1;
                //getGameObjectById('UI_dialog_requirement_detail').getBehaviour(TextRenderer).text=this.Order1_what;
                break;
            }
            case 2:{
                getGameObjectById('UI_dialog_requirement').getBehaviour(TextRenderer).text=this.Order2;
                this.Order_what=2;
                //getGameObjectById('UI_dialog_requirement_detail').getBehaviour(TextRenderer).text=this.Order2_what;
                break;
            }
            case 3:{
                getGameObjectById('UI_dialog_requirement').getBehaviour(TextRenderer).text=this.Order3;
                this.Order_what=3;
               // getGameObjectById('UI_dialog_requirement_detail').getBehaviour(TextRenderer).text=this.Order3_what;
                break;
            }
            case 4:{
                getGameObjectById('UI_dialog_requirement').getBehaviour(TextRenderer).text=this.Order4;
                this.Order_what=4;
               // getGameObjectById('UI_dialog_requirement_detail').getBehaviour(TextRenderer).text=this.Order4_what;
                break;
            }
            case 5:{
                getGameObjectById('UI_dialog_requirement').getBehaviour(TextRenderer).text=this.Order5;
                this.Order_what=5;
                //getGameObjectById('UI_dialog_requirement_detail').getBehaviour(TextRenderer).text=this.Order5_what;
                break;
            }
            default:{
                break;
            }
        }
    }

    GetRandomNum(Min:number,Max:number){
        let Range=Max-Min;
        let Rand=Math.random();
        return (Min+Math.round(Range*Rand));
    }

}



